<?php
class BizAction extends BaseAction {
	function _initialize() {
		parent::_initialize ();
		$this->dao = M ( 'User' );
	}
	/**
	 * 用户基本信息列表
	 */
	function info() {
		$model = M("Site");
		$condition = parent::create_where ();
		$count = $model->join(' as s left join `user` as u  on s.user_id = u.id')->where ( $condition )->count ();
		$this->assign ( "totalCount", $count );
		if ($count > 0) {
			$page = new Page ( $count, $this->listrows );
			$list = $model->field('s.*,u.username,u.mobile')->join(' as s left join `user` as u  on s.user_id = u.id')->where ( $condition )->order($this->order)->limit($page->firstRow,$page->listRows)->select();
			$this->assign ( 'list', $list );//dump($list);
		}
		$this->display ();
	}

	/**
	 * 用户页面内容列表
	 */
	function layout() {
		$model = M("Site");
		$condition = parent::create_where ();
		//$count = M( 'site' )->where ( $condition )->count ();
		$count = $model->join(' as s left join `user` as u  on s.user_id = u.id')->where ( $condition )->count ();
		$this->assign ( "totalCount", $count );
		if ($count > 0) {
			$page = new Page ( $count, $this->listrows );
// 			$list = $this->dao->join($join)->where ( $condition )->order ( $this->$order )->limit ( $page->firstRow . ',' . $page->listRows )->select ();
// 			$list = M()->query( "select u.id, u.username, u.mobile, s.name, 
// 				group_concat( a.id,'|',a.status,'|',a.title SEPARATOR '||' ) as ad,
// 				group_concat( t.id,'|',t.`type`,'|',t.`name` SEPARATOR '||' ) ptag
// 				FROM site AS s 
// 				LEFT JOIN user AS u ON s.user_id = u.id
// 				LEFT JOIN ads AS a ON s.user_id = a.user_id
// 				left join tags as t on s.user_id = t.user_id
// 				GROUP BY s.user_id
// 				limit {$page->firstRow},{$page->listRows}" );
			
			$list = $model->field("u.username,u.mobile,s.*,group_concat( a.id,'|',a.status,'|',a.title SEPARATOR '||' ) as ad,group_concat( t.id,'|',t.`type`,'|',t.`name` SEPARATOR '||' ) ptag")
			->join(" as s left join `user` as u on s.user_id = u.id")
			->join(" left join ads as a on s.user_id = a.user_id")
			->join(" left join tags as t on s.user_id = t.user_id")
			->group('s.user_id')->where($condition)->limit($page->firstRow,$page->listRows)->select();
			
			foreach ( $list as $k=>$v ) {
				$ad_arr = $pt_arr = array();
				$ad_re = explode( '||', $list[$k][ 'ad' ] );
				$pt_re = explode( '||', $list[$k][ 'ptag' ] );
				foreach ( $ad_re as $k2=>$v2 ) {
					if ( $v ) {
						$tmp = explode( '|', $v2 );
						$ad_arr[ $tmp[0] ] = $tmp[2];
					}
				}
				foreach ( $pt_re as $k2=>$v2 ) {
					if ( $v ) {
						$tmp = explode( '|', $v2 );
						$pt_arr[ $tmp[0] ][ $tmp[1] ] = $tmp[2];
					}
				}
				
				$re = M()->query( "select group_concat(l.cell_id) as cell,l.layout,l.user_id
					from site AS s 
					left join layout as l on l.user_id=s.user_id
					where l.user_id={$v['id']}
					group by l.layout" );
				//dump($re);
				foreach ( $re as $kk=>$vv ) {
					$pt_re = explode( ',', $vv[ 'cell' ] );
					
					foreach ( $pt_re as $v3 ) {
						$list[$k][ $vv['layout'] ]['ad'] = $ad_arr[ $v3 ];
						$list[$k][ $vv['layout'] ]['pr'] = $pt_arr[ $v3 ][1];
						$list[$k][ $vv['layout'] ]['ar'] = $pt_arr[ $v3 ][2];
					}
					
				}
				unset($list[$k][ 'ad' ]);
				unset($list[$k][ 'ptag' ]);
				
			}
			
			
			$this->assign ( 'list', $list );//dump($list);
		}
		$this->display ();
	}
	
	/**
	 * 选项卡,编辑修改
	 */
	function info_done() {
		//echo json_encode($_REQUEST);;die();		
		//地址基本信息
		if ( $_REQUEST['submit']==1 ) {
			M('site')->save( $_REQUEST );
			M('site_description')->save( $_REQUEST );
			$this->_ajm(200,'数据修改成功',0,$url?$url:U(MODULE_NAME.'/index'));
		}
		//自提点信息新增或修改
		if ( $_REQUEST['submit']==2 ) {
			M('o2o_store')->add( $_REQUEST,array(),true);
			$this->_ajm(200,'数据修改成功',0,$url?$url:U(MODULE_NAME.'/index'));
		}
		//幻灯信息新增或修改
		if ( $_REQUEST['submit']==3 ) {
			$data = array();
			//$_REQUEST['picture'];
			if($_REQUEST['picture']==null){
				$filePath = $this->_upload ();
				$data['picture'] =$filePath;
				if ( ! $data['picture'] ) unset($data['picture']);
				
			}
			foreach ( $_REQUEST as $key=>$value) {
				if($key!="submit"){
					$data[$key] = $value;
				}
			
			}
			M('banner')->add( $data,array(),true);
			$this->_ajm(200,'数据修改成功',0,U(MODULE_NAME.'/info_done'));
		}
		
		
		$cid = $_REQUEST['id'];
		$site_i = M()->query( "select s.id,s.name,s.domain,s.link_url,
				sd.logo,sd.title,sd.keyword,sd.info,sd.link_url_icp,
				sd.email,sd.qq,sd.telephone,sd.cellphone,sd.aliww
				from site as s
				left join site_description as sd on sd.site_id=s.id
				where s.user_id={$cid}" );
				
		//查询自提点信息
		$o2o_store = M()->query( "SELECT s.id,s.pid,s.consignee,s.zipcode,s.tel,s.address,s.province,s.city,s.district FROM o2o_store s WHERE s.pid={$cid}" );
				
		//幻灯信息
		$banners = M()->query( "SELECT * FROM  banner WHERE site_id = {$cid}" );
		
		//获取地区列表
		$provinces = $this->get_area(0);
		$citys = $this->get_area($o2o_store[0]['province']);
		$districts = $this->get_area($o2o_store[0]['city']);
		
		$this->assign('site', $site_i[0]);
		$this->assign('o2o_store', $o2o_store[0]);
		$this->assign('cid', $cid);
		$this->assign('list', $banners);
		$this->assign('provinces', $provinces);
		$this->assign('city', $citys);
		$this->assign('district',$districts);
		$this->display();
	}
	
	/**
	 * 编辑幻灯片
	 */
	function focus_edit(){
		$data = array();
		if ( $_REQUEST && $_REQUEST['id'] ) {
			$data['id'] = $_REQUEST['id'];
			unset($_REQUEST['id']);
			$filePath = $this->_upload();
			$data['picture'] =$filePath;
			if ( ! $data['picture'] ) unset($data['picture']);
			foreach ( $_REQUEST as $key=>$value) {
				$data[$key] = $value;
			}
			M('banner')->add( $data,array(),true);
			$this->_ajm(200,'更新成功',0);
		}
		$this->_ajm(300,'更新失败',0);
	}
	
	/**
	 * 异步更新信息幻灯
	 */
	public function update_field(){
		M('banner')->save( $_REQUEST);
		$this->_ajm(200,'更新成功',0);
	}
	
	/**
	 * 删除幻灯片
	 */
	public function del_focus(){
		$id = $_REQUEST['id'];
		$Banner = M ( 'banner' );
		$Banner->where('id ='.$id)->delete();
		$this->_ajm(200,'删除成功！',0,U('biz/info_done'));
	}
	/**
	 * 根据id查询幻灯信息
	 */
	public function get_banners(){
		//幻灯信息
		$id = $_REQUEST['id'];
		$banner = M()->query( "SELECT * FROM  banner WHERE id = {$id}" );
		$this->_ajm(200,"获取成功",0,false,'',$banner[0]);
		//$this->assign('banner', $banner);
	}
	
	/**
	 *
	 * @param $parent_id 获取该用户
	 *        	提货地址 省	市 县
	 * @return 省数组
	 */
	public function get_area($parent_id) {
		$model = M('Area');
		$ret = array ();
		$provinces = $model->where ( 'parentid=' . $parent_id )->select ();
		return $provinces;
	}
	
	/**
	 * ajax 返回地区信息
	 */
	public function ajaxarea(){
		$area = M('area');
		$id = $_REQUEST['id'];
		$where['parentid']=$_REQUEST['id'];
		$area=$area->where('parentid='.$id)->select();
		$this->ajaxReturn($area);
	}
	
	/**
	 * 标签列表
	 */
	function tag(){
		$cid = $_REQUEST['cid'];
		$count = M( 'tags' )->where ( array('user_id'=>$cid) )->count ();
		$this->assign ( "totalCount", $count );
		if ($count > 0) {
			$page = new Page ( $count, $this->listrows );
			$list = M()->query( "select t.id,t.name,group_concat(distinct layout) as layouts
				from tags as t
				left join layout as l on l.user_id=t.user_id and l.cell_id=t.id
				where t.user_id={$cid} group by t.id limit {$page->firstRow},{$page->listRows}" );
			$this->assign ( 'list', $list );//dump($list);
		}
		$this->assign ( 'cid', $cid );
		$this->display ();
	}
	
	/**
	 * 标签添加产品页，产品列表
	 */
	function add(){
		$tid = $_REQUEST['tid'];
		$condition = array('');
		$subobj = M( 'tags_obj' )->field( 'obj_id' )->where( array('tags_id'=>$tid) )->select();
		$subids = '0';
		foreach ( $subobj as $value ) {
			$subids .= ','.$value['obj_id'];
		}
		$order = $this->orderField . ' ' . $this->orderDirection;
		$m = M( 'product' );
		$count = $m->where ( "id not in ($subids)" )->count ();
		$this->assign ( "totalCount", $count );
		if ($count > 0) {
			$page = new Page ( $count, $this->listrows );
			$list = M()->query( "select * from product  limit {$page->firstRow},{$page->listRows}" );
			$this->assign ( 'list', $list );//dump($list);
		}

		$cats = M()->query( "select t.id,t.name,t.parent_id
				from tags as t
				left join layout as l on l.user_id=t.user_id and l.cell_id=t.id
				where t.user_id={$tid} group by t.id " );

    	$this->assign("cats",$cats);
		$cats=list_to_tree($cats,'id','parent_id');
    	$tree=tree($cats,'Biz/add');//dump($cats);die();
    	$this->assign("tree",$tree);
    	$this->assign("tid",$tid);
		$this->display ();
	}
	
	function add_tag(){
		$this->assign("uid",$_REQUEST['uid']);
		$this->display();
	}

	function insert(){
		if ( $_REQUEST['insert_t'] == 'tag' ) {
			$data = $_REQUEST;
			$m = M( 'tags');
			$m->add($data);
			//echo $m->getLastSql();
			$this->_ajm(200,'添加成功',0,U('Biz/tag',array('cid'=>$_REQUEST['user_id'])));
		}
		
		$tid = $_REQUEST['tid'];
		$data_t = $data_p = array();
		foreach ( $_REQUEST['ids'] as $value) {
			$tmp = array( 'tags_id'=>$tid, 'obj_id'=>$value, );
			$data_t[] = $tmp;
			$tmp = array( 'user_id'=>$_SESSION['userid'], 'product_id'=>$value,'status'=>0,'create_time'=>time() );
			$data_p[] = $tmp;
		}
		//dump($data_t);dump($data_p);die();
		M( 'tags_obj' )->addAll( $data_t );
		M( 'product_o2o' )->addAll( $data_p );
		
	}

	/**
	 * 产品列表
	 */
	function product(){
		$cid = $_REQUEST['cid'] = 13045;
		$pids = M( 'product_o2o' )->field('id')->where( array('user_id'=>$cid) )->order( 'id DESC' )->limit(0,10)->select();
		$ids = '0';
		foreach ($pids as $key => $value) {
			$ids .= ','. $value['id'];
		}
		$product = M()->query( "select p.id,p.name,group_concat(t.name) as tname
			from product_o2o as po
			left join tags_obj as o on o.obj_id=po.product_id
			left join tags as t on t.id=o.tags_id
			left join product as p on p.id=po.product_id
			where po.user_id={$cid} and po.id in({$ids})
			group by po.id" );
		$this->assign('list',$product);//dump($product);
		$this->display();
	}
	
	
	
	/******************************新布局使用方法****************************/
	
	/**
	 * 站点列表
	 */
	function site_list(){
		//获取参数属性
		$id = $_REQUEST['id'];
		$user_id = $_REQUEST['user_id'];
		$user_name = $_REQUEST['user_name'];
		$name= $_REQUEST['name'];
		$orderby=$_REQUEST['orderby'];
		$desc = $_REQUEST['desc'] = "desc";
		$size=$_REQUEST['size'] = 20;
		$page=$_REQUEST['page'] = 0;
		$sizesum=$size*$page;
		//根据条件查询
		$sql="SELECT s.id,s.user_id,(SELECT u.username FROM user u WHERE u.id = s.user_id),s.name,s.domain,s.status,s.link_url,s.link_url_status,s.times FROM site s WHERE 1=1";
		if($id!=null){
			$sql.=" AND s.id={$id}";
		}
		if($user_id!=null){
			$sql.=" AND s.user_id={$user_id}";
		}
		if($name !=null){
			$sql.=" AND s.name like %{$name}%";
		}
		if($user_name !=null){
			$sql.=" AND s.user_id in (SELECT id FROM user WHERE username like %{$user_name}%)";
		}
		if($orderby==null){
			$sql.=" order by s.id";
		}else{
			$sql.=" order by s.{$orderby} {$desc}";
		}
		if($size !=null && $size != null){
			$sql.=" limit {$sizesum},{$size}";
		}
		$sites = M()->query($sql);
		//返回数据
		$this->assign('list',$sites);
		$this->assign('page',$page);
		$this->assign('size',$size);
		$this->assign('orderby',$orderby);
		$this->assign('desc',$desc);
		$this->assign('name',$name);
		$this->assign('user_id',$user_id);
		$this->assign('id',$id);
		$this->assign('user_name',$user_name);
		$this->display();
	}
	/**
	 * 布局列表
	 */
	function layout_list(){
		//获取参数属性
		$id = $_REQUEST['id'];
		$user_id = $_REQUEST['user_id'];
		$cell_id = $_REQUEST['cell_id'];
		$layout = $_REQUEST['layout'];
		$type =$_REQUEST['type'];
		$user_name = $_REQUEST['user_name'];
		$orderby=$_REQUEST['orderby'];
		$desc = $_REQUEST['desc'] = "desc";
		$size=$_REQUEST['size'] = 20;
		$page=$_REQUEST['page'] = 1;
		$sizesum=$size*$page;
		//根据条件查询
		$sql="SELECT l.id,l.user_id,(SELECT u.username FROM user u WHERE u.id = l.user_id),l.cell_id,l.layout,l.type,l.status,l.elements,l.start_time,l.end_time,l.sequence FROM layout l WHERE 1=1";
		if($id!=null){
			$sql.=" AND l.id={$id}";
		}
		if($user_id!=null){
			$sql.=" AND l.user_id={$user_id}";
		}
		if($layout !=null){
			$sql.=" AND l.layout like %{$layout}%";
		}
		if($type!=null){
			$sql.=" AND l.type={$type}";
		}
		if($user_name !=null){
			$sql.=" AND l.user_id in (SELECT id FROM user WHERE username like %{$user_name}%)";
		}
		if($orderby==null){
			$sql.=" order by l.user_id";
		}else{
			$sql.=" order by l.{$orderby} {$desc}";
		}
		if($size !=null && $size != null){
			$sql.=" limit {$sizesum},{$size}";
		}
		$layouts = M()->query($sql);
		//返回数据
		$this->assign('list',$layouts);
		$this->assign('page',$page);
		$this->assign('size',$size);
		$this->assign('orderby',$orderby);
		$this->assign('desc',$desc);
		$this->assign('id',$id);
		$this->assign('user_id',$user_id);
		$this->assign('cell_id',$cell_id);
		$this->assign('layout',$layout);
		$this->assign('type',$type);
		$this->assign('user_name',$user_name);
		$this->display();
	}

	/**
	 * 标签列表
	 */
	function tags_list(){
		//获取参数属性
		$id = $_REQUEST['id'];
		$user_id = $_REQUEST['user_id'];
		$name = $_REQUEST['name'];
		$type =$_REQUEST['type'];
		$user_name = $_REQUEST['user_name'];
		$orderby=$_REQUEST['orderby'];
		$desc = $_REQUEST['desc'] = "desc";
		$size=$_REQUEST['size'] = 20;
		$page=$_REQUEST['page'] = 1;
		$sizesum=$size*$page;
		//根据条件查询
		$sql="SELECT t.id,t.parent_id,t.path,t.user_id,(SELECT u.username FROM user u WHERE u.id = t.user_id),t.type,t.name,t.alias,t.code,t.info,t.sequence FROM tags t WHERE 1=1";
		if($id!=null){
			$sql.=" AND l.id={$id}";
		}
		if($user_id!=null){
			$sql.=" AND l.user_id={$user_id}";
		}
		if($name !=null){
			$sql.=" AND l.name like %{$name}%";
		}
		if($type!=null){
			$sql.=" AND l.type={$type}";
		}
		if($user_name !=null){
			$sql.=" AND l.user_id in (SELECT id FROM user WHERE username like %{$user_name}%)";
		}
		if($orderby==null){
			$sql.=" order by l.user_id";
		}else{
			$sql.=" order by l.{$orderby} {$desc}";
		}
		if($size !=null && $size != null){
			$sql.=" limit {$sizesum},{$size}";
		}
		$tags = M()->query($sql);
		//返回数据
		$this->assign('list',$tags);
		$this->assign('page',$page);
		$this->assign('size',$size);
		$this->assign('orderby',$orderby);
		$this->assign('desc',$desc);
		$this->assign('id',$id);
		$this->assign('user_id',$user_id);
		$this->assign('name',$name);
		$this->assign('type',$type);
		$this->assign('user_name',$user_name);
		$this->display();
	}
	
	/**
	 * 产品列表
	 */
	function product_list(){
		//获取参数属性
		$id = $_REQUEST['id'];
		$user_id = $_REQUEST['user_id'];
		$name = $_REQUEST['name'];
		$tags_id = $_REQUEST['tags_id'];
		$status =$_REQUEST['status'];
		$orderby=$_REQUEST['orderby'];
		$layout_id = $_REQUEST['layout_id'];
		$desc = $_REQUEST['desc'] = "desc";
		$size=$_REQUEST['size'] = 20;
		$page=$_REQUEST['page'] = 1;
		$sizesum=$size*$page;
		//$user_name = $_REQUEST['user_name'];
		//根据条件查询
		$sql="SELECT p.* FROM product p WHERE 1=1";
		if($id!=null){
			$sql.=" AND p.id={$id}";
		}
		if($user_id!=null){
			$sql.=" AND p.id in (SELECT product_id FROM product_o2o WHERE user_id = {$user_id})";
		}
		
		if($name !=null){
			$sql.=" AND p.name like %{$name}%";
		}
		if($status!=null){
			$sql.=" AND p.status={$status}";
		}
		if($tags_id!=null){
			$sql.=" AND p.id in (select obj_id from tags_obj where tags_id = {$tags_id}";
		}
		if($layout_id!=null){
			$sql.=" AND p.id in (select obj_id from tags_obj where tags_id in (select cell_id from layout where id = {$layout_id}))";
		}
		//if($user_name !=null){
		//	$sql.=" AND p.user_id in (SELECT product_id FROM product_o2o WHERE user_id in (SELECT id FROM user WHERE username like %{$user_name}%))";
		//}
		if($orderby==null){
			$sql.=" order by l.user_id";
		}else{
			$sql.=" order by l.{$orderby} {$desc}";
		}
		if($size !=null && $size != null){
			$sql.=" limit {$sizesum},{$size}";
		}
		$layouts = M()->query($sql);
		//返回数据
		$this->assign('list',$layouts);
		$this->assign('page',$page);
		$this->assign('size',$size);
		$this->assign('orderby',$orderby);
		$this->assign('desc',$desc);
		$this->assign('desc',$desc);
		$this->assign('id',$id);
		$this->assign('tags_id',$tags_id);
		$this->assign('name',$name);
		$this->assign('layout_id',$layout_id);
		$this->assign('status',$status);
		//$this->assign('user_name',$user_name);
		$this->display();
	}
	/**
	 * 广告列表
	 */
	function ads_list(){
		//获取参数属性
		$id = $_REQUEST['id'];
		$user_id = $_REQUEST['user_id'];
		$user_name = $_REQUEST['user_name'];
		$name = $_REQUEST['name'];
		$status =$_REQUEST['status'];
		$layout_id = $_REQUEST['layout_id'];
		$tags_id = $_REQUEST['tags_id'];
		$title =$_REQUEST['title'];
		$orderby=$_REQUEST['orderby'];
		$desc = $_REQUEST['desc'] = "desc";
		$size=$_REQUEST['size'] = 20;
		$page=$_REQUEST['page'] = 1;
		$sizesum=$size*$page;
		//根据条件查询
		$sql="SELECT a.* FROM ads a WHERE 1=1";
		if($id!=null){
			$sql.=" AND a.id={$id}";
		}	
		if($user_id!=null){
			$sql.=" AND a.user_id={$user_id}";
		}
		if($title !=null){
			$sql.=" AND a.title like %{$title}%";
		}
		if($status!=null){
			$sql.=" AND a.status={$status}";
		}
		if($tags_id!=null){
			$sql.=" AND a.id in (select obj_id from tags_obj where tags_id = {$tags_id}";
		}
		if($user_name !=null){
			$sql.=" AND a.user_id in (SELECT id FROM user WHERE username like %{$user_name}%)";
		}
		if($layout_id!=null){
			$sql.=" AND a.id in {$layout_id}";
		}
		if($orderby==null){
			$sql.=" order by a.user_id";
		}else{
			$sql.=" order by a.{$orderby} {$desc}";
		}
		if($size !=null && $size != null){
			$sql.=" limit {$sizesum},{$size}";
		}
		$layouts = M()->query($sql);
		//返回数据
		$this->assign('list',$layouts);
		$this->assign('page',$page);
		$this->assign('size',$size);
		$this->assign('orderby',$orderby);
		$this->assign('desc',$desc);
		$this->assign('id',$id);
		$this->assign('layout_id',$layout_id);
		$this->assign('user_name',$user_name);
		$this->assign('title',$title);
		$this->assign('user_id',$user_id);
		$this->assign('tags_id',$tags_id);
		$this->assign('name',$name);
		$this->assign('status',$status);
		$this->display();
	}
	/**
	 * 文章列表
	 */
	function article_list(){
		//获取参数属性
		$id = $_REQUEST['id'];
		$user_id = $_REQUEST['user_id'];
		$user_name = $_REQUEST['user_name'];
		$name = $_REQUEST['name'];
		$status =$_REQUEST['status'];
		$tags_id = $_REQUEST['tags_id'];
		$title =$_REQUEST['title'];
		$orderby=$_REQUEST['orderby'];
		$layout_id = $_REQUEST['layout_id'];
		$desc = $_REQUEST['desc'] = "desc";
		$size=$_REQUEST['size'] = 20;
		$page=$_REQUEST['page'] = 0;
		$sizesum=$size*$page;
		//根据条件查询
		$sql="SELECT a.* FROM article a WHERE 1=1";
		if($id!=null){
			$sql.=" AND a.id={$id}";
		}
		if($user_id!=null){
			$sql.=" AND a.user_id={$user_id}";
		}
		if($title !=null){
			$sql.=" AND a.title like %{$title}%";
		}
		if($status!=null){
			$sql.=" AND a.status={$status}";
		}
		if($tags_id!=null){
			$sql.=" AND a.id in (select obj_id from tags_obj where tags_id = {$tags_id}";
		}
		if($user_name !=null){
			$sql.=" AND a.user_id in (SELECT id FROM user WHERE username like %{$user_name}%)";
		}
		if($layout_id!=null){
			$sql.=" AND a.id in (select obj_id from tags_obj where tags_id in (select cell_id from layout where id = {$layout_id}))";
		}
		if($orderby==null){
			$sql.=" order by a.user_id";
		}else{
			$sql.=" order by a.{$orderby} {$desc}";
		}
		if($size !=null && $size != null){
			$sql.=" limit {$sizesum},{$size}";
		}
		$layouts = M()->query($sql);
		//返回数据
		$this->assign('list',$layouts);
		$this->assign('page',$page);
		$this->assign('size',$size);
		$this->assign('orderby',$orderby);
		$this->assign('desc',$desc);
		$this->assign('id',$id);
		$this->assign('user_name',$user_name);
		$this->assign('title',$title);
		$this->assign('user_id',$user_id);
		$this->assign('tags_id',$tags_id);
		$this->assign('name',$name);
		$this->assign('status',$status);
		$this->assign('layout_id',$layout_id);
		$this->display();
	}
	
	
}